#include "Node.h"

using namespace Huffman;

Node::Node(void)
{
	symbol = 0;
	weight = 0;
	order = 0;

	left = 0;
	right = 0;
	parent = 0;
	id = 0;
}

Node::Node(int symbol, int weight, int order) 
{
	this -> symbol = symbol;
	this -> weight = weight;
	this -> order = order;
	
	left = 0;
	right = 0;
	parent = 0;
	id = 0;
}

Node::~Node(void)
{
	// empty destructor
}

int Node::getId() const 
{
	return id;
}

void Node::setId(int n) 
{
	this -> id = n;
}

Node* Node::getLeft() const 
{
	return left;
}

void Node::setLeft(Node* n) 
{
	this -> left = n;
}

Node* Node::getRight() const 
{
	return right;
}

void Node::setRight(Node* n) 
{
	this -> right = n;
}

Node* Node::getParent() const 
{
	return parent;
}

void Node::setParent(Node* n) 
{
	this -> parent = n;
}

int Node::getWeight() const 
{
	return weight;
}
		
void Node::setWeight(int weight) 
{
	this -> weight = weight;
}

int Node::getSymbol() const 
{
	return symbol;
}

void Node::setSymbol(int symbol) 
{
	this -> symbol = symbol;
}

int Node::getOrder() const 
{
	return order;
}

void Node::setOrder(int order)
{
	this -> order = order;
}

int Node::getParity() const
{
	return parity;
}

void Node::setParity(int parity) 
{
	this -> parity = parity;
}

Node* Node::getNext() const 
{
	return next;
}

void Node::setNext(Node* n) 
{
	this -> next = n;
}

Node* Node::getPrev() const 
{
	return prev;
}

void Node::setPrev(Node* n) 
{
	this -> prev = n;
}

bool Node::isLeaf() 
{
	return left == 0 && right == 0;
}